using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CMS_SUN_IF_Extraction
{
    public partial class frmVerificationForm : Form
    {
        private BAL bao = new BAL();
        public frmVerificationForm()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnCheckAll_Click(object sender, EventArgs e)
        {
            bao.gVerify_b4_Export();
        }

        private void cbCheck_Type_SelectedIndexChanged(object sender, EventArgs e)
        {
            string uSQLStr="";
            uSQLStr = "Select VAT_Number, Date_Visit, Patient_name, Accounts, "
                    + " T0, T2, T3, USD_Amount as Amount, DC_ind, UPD_PAY_ACCTCODE, UPD_PAYMENT_Date, UPD_SUN_IMPORT "
                    + " from qExtract_Final_Output ";
            string sel_str = cbCheck_Type.SelectedItem.ToString();
            
            switch (sel_str)
            {
                case "Blank Payment Mode":
                    uSQLStr += " where UPD_PAY_ACCTCODE = ' '";
                    break;
                case "Blank Account Code":
                    uSQLStr += " where ACCOUNTS IS NULL";
                    break;
                case "Blank T2 Code":
                    uSQLStr += " where T2 = ''";
                    break;
            }

            DataTable tbl = bao.get_DataSource(uSQLStr);
            /*if (tbl == null)
                return;*/
            if (tbl == null || tbl.Rows.Count == 0)
            {
                MessageBox.Show("No records match the criteria you entered.", "No Records Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
                
            }
            bindingSource1.DataSource = tbl;
            bindingSource1.ResetBindings(false);
        }

        private void frmVerification_Load(object sender, EventArgs e)
        {
            lstVerification.DataSource = bindingSource1;

        }

    }
}